{% extends "admin/change_list.html" %}
{% load i18n admin_urls static admin_list %}


{% block title %} 表字段维护 | 元数据管理平台 {% endblock %}

{% block extrahead %}
{{ block.super }}
{{ media.js }}
{% endblock %}


{% block content_title %} 表字段信息维护 {% endblock %}


{% block breadcrumbs %}
<ol class="breadcrumb">
    <li><a href="{% url 'admin:index' %}"><i class="fa fa-dashboard"></i> {% trans 'Home' %}</a></li>
    <li><a href="javascript:void(0)">元数据管理</a></li>
    <li class="active">表字段维护</li>
</ol>
{% endblock %}

{% block content %}
<div class="col-md-12">
    <div class="row">
      <div class="col-md-9">
          <strong>数据库名</strong>：{{ table_info.db_name }} &nbsp;&nbsp;&nbsp;
          <strong>表名</strong>：{{ table_info.tbl_name }}
          <div class="row">
              <br />
          </div>
      </div>

        <form action="/column/column_edit/" method="post">
        <div class="col-md-9">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h4 class="box-title">
                        列信息维护
                    </h4>
                </div>

                <div class="box-body">
                <input type="hidden" name="tbl_id" value="{{ tbl_id }}" />
                 <table id="result_list" class="table table-bordered table-hover dataTable">
                      <thead>
                      <tr>
                          <th scope="col"><span>id</span></th>
                          <th scope="col"><span>字段名称</span></th>
                          <th scope="col"><span>类型</span></th>
                          <th scope="col"><span>原始描述</span></th>
                          <th scope="col"><span>修改描述</span></th>
                      </tr>
                      </thead>
                      <tbody>
                      {% for result in results %}
                        <tr>
                          <td class="field">{{ result.column_idx }}</td>
                          <td class="field">{{ result.column_name }}</td>
                          <td class="field">{{ result.column_type }}</td>
                          <td class="field">{{ result.column_desc }}</td>
                          <input type="hidden" name="idArr[]"  value="{{ result.id }}" />
                          <td class="field"><input type="text" size="55" name="columnArr[]" value="{{ result.column_desc_maintain }}" ></td>

                        </tr>
                      {% endfor %}

                      </tbody>
                    </table>
                </div>

            </div>

        </div>

        <div class="col-md-3 hidden-sm hidden-xs">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h4 class="box-title">
                        操作面板
                    </h4>
                </div>

                <div class="box-body">
                    <div class="form-group">
                        <input type="submit" value="保存" class="btn btn-primary form-control" name="_save">
                    </div>

                    <div class="form-group">
                        <input type="button" value="返回详情页" id="return_search" class="btn btn-primary form-control" name="_save">
                    </div>
                </div>

            </div>

        </div>
        </form>
    </div>

</div>

{% endblock %}
{% block extrajs %}
<script>
    $(document).ready(function(){
        var db_name='{{ table_info.db_name }}'
        var table_name = '{{ table_info.tbl_name }}'
        console.log(db_name)
        $("#return_search").click(function(){
            window.location.href='/admin/metadata/detail/?db_name='+db_name +'&table_name=' + table_name;
        })
    })
</script>
{% endblock %}